package com.example.demo.async;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @author Jiange
 * @create 2021-05-08-19:48
 */
@Service
public class AsyncService {
    @Async
    public String async() throws InterruptedException {
        Thread.sleep(3000);
        return "async";
    }

    @Scheduled(cron = "0 * * * * 0-7")
    public void schedule(){
        System.out.println("定时任务");;
    }
}
